package wangyi;

import java.util.Scanner;

public class DualCoreCpu{
    public static void main(String[] agrs) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int time[] = new int[n];
            int sum = 0;
            for (int i =0; i < n; i++) {
                time[i] = sc.nextInt() >> 10;
                sum += time[i];

            }
            int half = minTime(n, sum / 2, time);
            int min = Math.max(half, sum-half);
            System.out.println(min << 10);
        }
    }

    private static int minTime(int n, int m, int[] time) {
        int sum[][] = new int[n+1][m+1];
        for (int i = 0; i < n + 1; i++) {
            sum[i][0] = 0;
        }
        for (int j = 0; j < m + 1;j++) {
            sum[0][j] = 0;
        }
        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < m + 1; j++) {
                if (time[i - 1] <= j) {
                    if (sum[i - 1][j] > sum[i-1][j - time[i - 1]] + time[i -1]) {
                        sum[i][j] = sum[i-1][j];
                    }
                    else {
                        sum[i][j] = sum[i-1][j - time[i - 1]] + time[i -1];
                    }
                }
                else {
                    sum[i][j] = sum[i-1][j];
                }
            }
        }
        return sum[n][m];
    }
}